package com.cctc.security.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cctc.security.dao.ResourceDao;
import com.cctc.security.domain.Resource;
import com.cctc.security.services.ResourceService;

@Service("resourceService")
public class ResourceServiceImpl<T extends Resource> implements ResourceService<T>
{
    @Autowired
    private ResourceDao<T> resourceDao;
    
    @Override
    public void addResource(T t)
    {
        this.resourceDao.addResource(t);
    }
    
    @Override
    public void delResource(T t)
    {
        this.resourceDao.delResource(t);
    }
    
    @Override
    public void updateResource(T t)
    {
        this.resourceDao.updateResource(t);
    }
    
    @Override
    public T findResourceById(String id)
    {
        return (T) this.resourceDao.findResourceById(id);
    }
    
    @Override
    public List<String> getResourcesUrlByAuthoritieName(String authoritieName)
    {
        return (List<String>) this.resourceDao.getResourcesUrlByAuthoritieName(authoritieName);
    }
}
